﻿using CatUtils.Utils.Currency.TextUtils;
using CatUtils.Utils.SpecialUtils.View;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace PicACGTool.UserUtils.UserView.Winform
{
    public partial class MessageAlert : Form
    {
        public MessageAlert()
        {
            InitializeComponent();
        }

        public MessageAlert(string Cntag, string RomaTag, string Content)
        {
            InitializeComponent();
            textBox1.Text = Cntag;
            textBox2.Text = RomaTag;
            richTextBox1.Text = Content;
            Clipboard.SetDataObject(textBox1.Text, true);
            ChangeAlert(textBox1.Text);
        }

        private void textBox1_Click(object sender, EventArgs e)
        {
            Clipboard.SetDataObject(textBox1.Text, true);
            ChangeAlert(textBox1.Text);
        }

        private void ChangeAlert(string AlertContent)
        {
            label4.Text = $"已复制文本内容【{TextHelper.Substring(AlertContent, 0, 15)}】";
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
        }

        private void textBox2_Click(object sender, EventArgs e)
        {
            Clipboard.SetDataObject(textBox2.Text, true);
            ChangeAlert(textBox2.Text);
        }

        private void richTextBox1_Click(object sender, EventArgs e)
        {
            Clipboard.SetDataObject(richTextBox1.Text, true);

            ChangeAlert(richTextBox1.Text);
        }

        private void richTextBox1_TextChanged(object sender, EventArgs e)
        {
        }

        private void MessageAlert_KeyDown(object sender, KeyEventArgs e)
        {
            Console.WriteLine(e.KeyCode);
            if (e.KeyCode == Keys.Escape) //"Ctrl + D"触发
            {
                Close();
            }
        }
    }
}